<?php defined( '_VALID_MOS' ) or die( 'Restricted access' );?>
<?php 
if(!$uid)
{
 ?>
 <TABLE width="100%" border="0" cellpadding="0" cellspacing="0">
  <TR valign="top">
    <TD width="150"><?php require_once( $mosConfig_absolute_path ."/administrator/components/com_jcs/menubar.php" );?></TD>
    <TD>&nbsp;</TD>
    <TD>
    <table class="adminheading">
			<tr>
				<th class="user">
					<!--<IMG src="images/sections.png" align="middle" />-->
          User Subscriptions
				</th>
			</tr>
			</table>

<form action="index2.php" method="post" name="adminForm" id="adminForm" enctype="multipart/form-data">

<div align="right">
User ID: 
<INPUT type="text" class="text" name="suser_id" size="3" maxlength="5" value="<?php echo $suser_id ?>" />
&nbsp;
Subscription ID : 
<INPUT type="text" class="text" name="ssubscription_id" size="3" maxlength="7"  value="<?php echo $ssubscription_id ?>" />

State: 
<SELECT name="state">
<OPTION value="10">- All -</OPTION>
<OPTION value="1">Published</OPTION>
<OPTION value="0">Unpublished</OPTION>
</SELECT>

<INPUT class="button" type="button" value="Filter" onclick="submitform('usub');" />
</div>
<?php 
}
 ?>
    <TABLE class="adminlist">
    <TR>
    <Th width="10">#</Th>
    <?php if(!$uid) {?><Th width="10"><input type="checkbox" name="toggle" value=""  onclick="checkAll(<?php echo count($rows) + 1?>);" /></Th><?php }; ?>
    <Th align="left">Subscription</Th>
    <Th align="left">Subscriber Name</Th>
    <Th width="1%">Gateway</Th>
    <Th width="1%">ID</Th>
    <Th width="1%" nowrap="nowrap">Days Left</Th>
    <Th width="1%">Published</Th>
    <Th width="1%">Limit</Th>
    <Th width="1%">Count</Th>
    <Th width="1%">Start</Th>
    <Th width="1%">Expire</Th>
    <Th width="1%">Price</Th>
    </TR>
    <?php 
    $k = 0;
    $i = 0;
    $sign = JEConfig::get('general.curr');
    foreach($rows AS $row)
    {
            $uurl = 'index2.php?option=com_users&task=editA&hidemainmenu=1&id='.$row->uid;
            $over = '';

    ?>
        <TR class="<?php echo "row$k"; ?>">
        <TD><?php echo $row->id ?></TD>
        <?php if(!$uid) {?><TD><?php echo mosCommonHTML::CheckedOutProcessing( $row, $i );?></TD><?php }; ?>
        <TD>[<?php echo $row->sid ?>] <a href="index2.php?option=com_jcs&task=uedit&cid[]=<?php echo $row->id ?>"><?php echo $row->name ?></a></TD>
        <TD>[<?php echo $row->uid ?>] <a<?php echo $over ?>  href="<?php echo $uurl?>"><?php echo $row->uname ?></a> <a href="mailto:<?php echo $row->email ?>"><I>(<?php echo $row->email ?>)</I></a></TD>
        <TD><?php echo $row->gateway ?></TD>
        <TD><?php echo $row->gateway_id ?></TD>
        <TD align="right"><?php echo $row->days ?></TD>
        <TD align="center"><?php
         if($uid)
         {
           $felix_img = $row->published ? '/images/tick.png': '/images/publish_x.png';
           $felix_img = $mosConfig_live_site.$felix_img;
           ?>
             <A href="javascript:void(0);" onClick="
               document.getElementById('publish_img_<?php print $i;?>').src='<?php print $mosConfig_live_site;?>/administrator/components/com_juser/img/load.gif';
               xajax_jcsPublishX('<?php echo $row->id; ?>',<?php print $i;?>)" >
                   <img border="0" src="<?php echo $felix_img; ?>" id="publish_img_<?php print $i;?>">
             </A>
         <?php
         }
         else
            echo jcsPublishedProcessing( $row, $i );
         
         ?></TD>
        <TD align="center" nowrap="nowrap"><?php echo $row->access_limit ? $row->access_limit : 'No Limit' ?></TD>
        <TD align="center"><?php echo intval($row->access_count) ?></TD>
        <TD nowrap="nowrap"><?php echo $row->ctime ?></TD>
        <TD nowrap="nowrap"><?php echo $row->extime ?></TD>
        <TD nowrap="nowrap"><?php echo $row->price ?> <?php echo $sign ?></TD>
        </TR>
    <?php
        $i++;
				$k = 1 - $k;
    }
    ?>
		<?php if(!$uid){echo $pageNav->getListFooter();} ?>
    </TABLE>
<?php 
if(!$uid)
{
 ?>
<INPUT type="hidden" name="section" value="#__jcs_user_subscr" />
<INPUT type="hidden" name="id" value="<?php echo $cid;?>">
<input type="hidden" name="option" value="com_jcs" />
<input type="hidden" name="task" value="usub" /><?php //echo $task ?>
<input type="hidden" name="boxchecked" value="0" />
<input type="hidden" name="hidemainmenu" value="0" />
</form>

   </TD>
  </TR>
</TABLE>
<?php 
}
 ?>
